/*
 *  TestCommon.h
 *  SoundController0002
 *
 *  Created by jiro on 10/07/17.
 *  Copyright 2010 jiro music. All rights reserved.
 *
 */

#pragma once

#include "../SoundController.h"

namespace sc
{
	template< class AudioData >
	void Play( AudioRecorder< AudioData >& recorder, AudioPlayer& player )
	{
		std::vector< float > data1;
		std::vector< float > data2;
		recorder.GetAudioData( 0, data1 );
		recorder.GetAudioData( 1, data2 );

		std::vector< std::vector< float >* > dataByChannel;
		dataByChannel.push_back( & data1 );
		dataByChannel.push_back( & data2 );

		player.LoadAudioData( dataByChannel );
		player.Play( 0 );
		while ( player.IsPlaying() )
		{
			usleep( 1000 );
		}
		player.Stop();	
		usleep( 500 );
	}
}
